package com.hnucm.c202001020214;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.os.Bundle;

import com.gyf.immersionbar.ImmersionBar;
import com.hnucm.c202001020214.object.Book;

import java.util.ArrayList;
import java.util.List;

public class Book_qw extends BaseActivity {

    public List<Book> bookList = new ArrayList<>();
    RecyclerView recyclerView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_book_qw);

        ImmersionBar.with(this)
                // .statusBarColor(R.color.touming)
                .init();

        recyclerView =findViewById(R.id.recyclerview);
        LinearLayoutManager layoutManager = new LinearLayoutManager(Book_qw.this);
        recyclerView.setLayoutManager(layoutManager);

        BookAdapter adapter = new BookAdapter(bookList);
        recyclerView.setAdapter(adapter);

        initBook();

    }

    public void initBook(){
        Book book01 = new Book(R.drawable.book_01,"程序员的英语","48.88元");
        bookList.add(book01);
        Book book02 = new Book(R.drawable.book_02,"java从入门到项目实战","59.99元");
        bookList.add(book02);
        Book book03 = new Book(R.drawable.book_03,"C语言从入门到项目实战","68.00元");
        bookList.add(book03);
        Book book04 = new Book(R.drawable.book_04,"IT文化","56.00元");
        bookList.add(book04);
        Book book05 = new Book(R.drawable.book_05,"区块链技术及应用","99.00元");
        bookList.add(book05);
        Book book06 = new Book(R.drawable.book_06,"数据结构和算法实战","58.88元");
        bookList.add(book06);
        Book book08 = new Book(R.drawable.book_08,"深入浅出MySql","79.00元");
        bookList.add(book08);
        Book book09 = new Book(R.drawable.book_09,"IT运维之道","56.00元");
        bookList.add(book09);




    }
}